<template>
  <div>
    <div class="header">
      <!-- 搜索框 -->
      <div class="search">
          <navigator url="../search/index" hover-class="navigator-hover">


      <!-- 搜索框 -->
      <div class="search">
          <navigator url="../search/index" hover-class="navigator-hover">
          搜索
          <icon type="search" size="20" />
        </navigator>
      </div>
      <!-- 头部切换 -->
      <div class="tabBox">
        <div>
          <div
            v-for="(item, index) in tabData"
            :key="index"
            :class="tabIndex == index ? 'active' : ''"
            @click="tabBtn(index)"
          >
            <span>{{ item }}</span>

      <div class="headerTop">
        <!-- 搜索框 -->
        <div class="search">
          <navigator url="../search/index" hover-class="navigator-hover"
            ><icon type="search" size="20" />
          </navigator>
        </div>
        <!-- 头部切换 -->
        <div class="tabBox">
          <div>
            <div
              v-for="(item, index) in tabData"
              :key="index"
              :class="tabIndex == index ? 'active' : ''"
              @click="tabBtn(index)"
            >
              <span>{{ item }}</span>
            </div>

          </div>
        </div>
      </div>
      <!-- 数据列表 -->
      <div class="listBox">
        <div v-if="tabIndex == 0"><Hot /></div>
        <div v-if="tabIndex == 1"><ToThems /></div>
      </div>
    </div>
  </div>
</template>

<script>
import ToThems from "../../components/ToThems";
import Hot from "../../components/Hot";
export default {
  components: {
    Hot,
    ToThems,
  },
  data() {
    return {
      tabData: ["热门", "追番"],
      tabIndex: 0,
    };
  },
  onLoad() {},

  methods: {
    tabBtn(index) {
      this.tabIndex = index;
    },
  },
};
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  > .headerTop {
    width: 100%;
    height: 190rpx;
    display: flex;

    align-items: center;
    justify-content: center;
    padding: 25rpx 0;

    > navigator {
      width: 90%;
      height: 60rpx;
      border-radius: 30rpx;
      background: #eee;
      text-align: center;
      line-height: 60rpx;
      color: #888;
   
    }

    flex-direction: column;

}
    //搜索框
    .search {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 25rpx 0;
      > navigator {
        width: 90%;
        height: 60rpx;
        border-radius: 30rpx;
        background: rgb(206, 204, 204);
        display: flex;
        align-items: center;
        padding-left: 30rpx;
        i {
          font-size: 40rpx;
        }
      }



  }
  //tab切换
  .tabBox {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    > div {
      width: 90%;
}

    }
    //tab切换
    .tabBox {
      width: 100%;

      display: flex;
      align-items: center;
      justify-content: center;
      > div {
        width: 90%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20rpx 0;
        > div {
          flex: 1;
          text-align: center;
          > span {
            padding: 20rpx;
            margin: 0 30rpx;
          }
        }
      }
      .active {
        > span {
          padding: 20rpx;
          margin: 0 30rpx;
          border-bottom: 6rpx solid #fd7aa6;
          z-index: 99;
        .active {
          > span {
            padding: 20rpx;
            margin: 0 30rpx;
            border-bottom: 6rpx solid rgb(224, 22, 147);
          }
        }
      }
    }
  }

  .listBox {
    display: flex;
    flex: 1;
    overflow-y: scroll;
    border-top: 1rpx solid #999;
    margin-top: 6rpx;
  }
}

</style>
